<?php


//返回错误信息
function error($msg = '',$data = '', $other_result = [],$code = 0){

    //$request = request();

    $result = [
        'code' => $code,
        'message'  => $msg,
        'result' => $data,
        'type'=>'error'
    ];

    $result = array_merge($result,$other_result);

    return json($result);
}

//返回成功信息
function success($msg = '',$data = '', $other_result = [],$code = 1){

    //$request = request();

    $result = [
        'code' => $code,
        'message'  => $msg,
        'result' => $data,
        'type'=>'success'
    ];

    $result = array_merge($result,$other_result);

    return json($result);
}